import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
import { BaseEntity } from './base.entity';
import Photo from './photo.entity';
import Job from './job.entity';
import JobFairs from './job-fairs.entity';

/**
 * 公司
 */
@Entity('company')
export default class Company extends BaseEntity {
  @PrimaryGeneratedColumn()
  id: number;

  @OneToMany(() => Photo, (photo) => photo.company)
  photos: Photo[];

  @OneToMany(() => Job, (job) => job.company)
  jobs: Job[];

  @ManyToOne(() => JobFairs, (jobFairs) => jobFairs.companys)
  @JoinColumn({ name: 'job_fairs_id' })
  jobFairs: JobFairs;

  @Column({ name: 'user_id', nullable: true, comment: '用户ID' })
  userId: string;

  @Column({ comment: '公司简称' })
  name: string;

  @Column({ name: 'full_name', comment: '公司全称' })
  fullName: string;

  @Column({ comment: 'LOGO' })
  logo: string;

  @Column({ name: 'industry_id', nullable: true, comment: '所属行业' })
  industryId: number;

  @Column({ comment: '公司性质' })
  nature: string;

  @Column({ comment: '公司规模' })
  scale: string;

  @Column({ comment: '公司福利' })
  welfare: string;

  @Column({ name: 'work_time', comment: '上班时间' })
  workTime: string;

  @Column({ comment: '周末' })
  weekend: string;

  @Column({ name: 'work_overtime', comment: '加班情况' })
  workOvertime: string;

  @Column({ comment: '公司地址' })
  address: string;

  @Column({comment: '官网链接'})
  link: string;

  @Column({ type: 'text', comment: '公司简介' })
  introduce: string;
}
